home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
dbase
/
do1beta.zip
/
CLASSLIB.DOC
< prev
next >
Wrap
Text File
|
1991-08-23
|
85KB
|
1,561 lines
dObject Version 1.0 Class Library Reference
Object-Oriented Programming Language for DBASE(tm)
Copyright (c) 1991 Intelligent Systems Research
All Rights Reserved
dObject Version 1.0 (c) 1991 Intelligent Systems Research
1.0 dObject Class Library
This section describes the class library in detail.
1.1 Array Class
Message Argument(s) Description
at self, Collection returns the object stored at
index(es) specified by the
Collection arg. Each element in
the Collection arg must be of
type Int. Example: a =
new(Array,[3,3,3]);
replace(a,[0,0,0],1); ?
at(a,[0,0,0]);
class self returns the String "Array"
dim self returns Collection of array
dimensions for self
len self returns the defined size of self as
Int
replace self, Collection, stores Object arg at location
Object within self as specified by
index(es) in Collection arg. Each
element in the Collection must be
of type Int. Example: a =
new(Array,[3,3,3]);
replace(a,[0,0,0],1); ?
at(a,[0,0,0]);
1.2 Nil Class
Message Argument(s) Description
class returns the String "Nil"
clearDevice clears the current BGI graphics
screen and moves CP to (0,0) in
the current viewport. see
Nil::clearViewPort
clearMemory removes all user class definitions,
method definitions, and variables
from memory
clearViewPort clears the current BGI viewport and
moves the CP to (0,0) see
Nil::clearDevice()
closeAllDbfs closes all currently open Dbffile
objects
closeAllWindows closes all currently open Window
objects
currentDbf returns currently selected database
as Dbffile object
- 2 -
Chapter 1: dObject Class Library
currentNdx returns currently selected index
file as Ndxfile object
currentWindow returns current window as Window
object
date returns current system date
disk returns the current disk and
directory path as String
inkey returns input from keyboard as Int;
key codes are defined in the file
"keydef.do"
memory returns amount of free memory as
Real
osVersion returns DOS version as String
readchar returns next Char from current
input device
restoreCrtMode restores the original CRT mode
detected by initGraph
setupKeyboard allow user to interactively define
keyboard setup and key
assignments using menu system.
Allows re-definition of editor
function keys. See also:
String::loadConfig and
String::saveConfig methods
setupStatus allow user to interactively define
status line text for editor, etc.
sysPath returns path from where dObject was
started
time returns current time as String
formatted as HH:MM:SS.XX where
HH = hours MM = minutes SS =
seconds XX = hundreths of second
detectGraph returns a Collection of 2 Int
values specifying the current
graphics driver and mode.
getDriverName returns a String containing the
name of the current graphics
driver.
getGraphMode returns an Int containing the
current graphics mode.
getMaxMode returns an Int containing the
maximum mode number for the
currently loaded driver.
graphDefaults sets the graphics system to default
values: Viewport: mamimum device
resolution Clipping: on
Palette: default for drive
Background color: 0 Drawing
color: max color Fill style:
solid fill Fill color: max color
Line style: solid line Hardware
font direction: horizontal Font
- 3 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
size: 1 Font justification: left
top Current position: home (0,0)
closeGraph closes the BGI graphics system,
unloads the driver from memory,
and restores the CRT to its
original state before
initGraph() was called.
restoreCrtMode restores the CRT to its original
state.
getX returns the x co-ordinate of the CP
getY returns the y co-ordinate of the CP
getMaxX returns the max X value for the
current graphics driver and mode
getMaxY returns the max Y value for the
current graphics driver and mode
getLineSettings returns collection of 3 Int args
representing current line style,
user-defined pattern, and thickness
code as described above.
getArcCoords returns a Collection of 6 Int
values containing the x,y center
point, x,y start pos, and x,y end
pos of the arc. This is useful
if you need to make a line meet at
the end of an arc.
getAspectRatio returns Collection of 2 Int value
representing the x and y aspect
ratio correction values of the
current graphics mode.
setAspectRatio self, Int sets the x and y aspect-ratio
correction factors to self and
Int arg respectively.
getBkcolor self returns the current background
color
getColor returns the current drawing color
getMaxColor returns the maximum color value
available in the current graphics
mode
getFillPattern returns the current user-defined
fill pattern as a Collection of 8
Int values.
getFillSettings returns a Collection of 2 Int
values; the first is the current
fill pattern; the second is the
current fill color
getTextSettings returns Collection of 4 Int values
indicating current text font,
direction, size, and justification
getViewSettings returns a Collection of 5 Int value
specifying the left, top right,
and bottom screen co-ordinates of
the current viewport, and an Int
- 4 -
Chapter 1: dObject Class Library
flag indicating if clipping is
on or off.
getPalette self returns a Collection containing the
current palette
getDefaultPaletteself returns a Collection containing the
default palette
getPaletteSize self returns Int size of current Palette
1.3 Int Class
Message Argument(s) Description
abs self returns absolute value of self as
Int
asString self returns self as a String
asReal self returns self as a Real
bitnot self returns self with NOT of each bit
as Int
bitand self, Int returns self ANDed with argument as
Int
bitor self, Int returns self ORed with argument as
Int
bitxor self, Int returns self XORed with argument as
Int
bitleft self, Int returns self left-shifted by
argument as Int
bitright self, Int returns self right-shifted by
argument as Int
cday self returns name of nth day of week as
String
chr self returns Char with ASCII code of
self
class self returns the String "Int"
onError self called from dObject whenever error
occurs prints error message to
error window for error code of self
you can re-define this method to
handle errors differently
executeKey self provide standard dObject key
handling from within form
exit self exits to dObject prompt with return
code of self
format self, String formats self according to format
spec in String arg returns
String Format codes: %d Normal
decimal number. (chars and
integers) %u As an unsigned
integer. (chars and integers)
%x As a hexadecimal number. (chars
and integers). %c As a char.
(chars and integers).
onApplicationKeyself, Exp evaluates Exp whenever application
- 5 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
key with number of self is
pressed within text editor.
operator(+) self, Int return self plus argument
operator(-) self, Int returns self minus argument
operator(*) self, Int returns self multiplied by argument
operator(==) self, Int returns true if self is equal to
argument
operator(!=) self, Int returns true if self is not equal
to argument
operator(+) self, Real returns self plus argument as Real
operator(+) self, Int returns self plus argument as Int
operator(-) self, Real returns self minus argument as Real
operator(-) self, Int returns self minus argument as Int
operator(-) self returns negative of self as Int
operator(*) self, Real returns self multiplied by argument
as Real
operator(*) self, Int returns self multiplied by argument
as Int
operator(/) self, Real returns self divided by argument as
Real
operator(/) self, Int returns self divided by argument as
Int
operator(<) self, Int returns true if self less than
argument
operator(>) self, Int returns true if self greater than
argument
operator(<=) self, Int returns true if self less than or
equal to argument
operator(>=) self, Int returns true if self greater or
equal to argument
operator(<) self, Real returns true if self less than
argument
operator(>) self, Real returns true if self greater than
argument
operator(<=) self, Real returns true if self less than or
equal to argument
operator(>=) self, Real returns true if self greater or
equal to argument
say self, Int, Char writes Char to current window at y,
x of self, Int arg
max self, Int returns max of self and argument as
Int
min self, Int returns min of self and argument as
Int
random self returns random number as Int with
self as modulus
randomInit self initializes random number generator
with self as seed
setWriteMode self sets the writing mode for line
drawing if self = 0, line color
will overwrite what is on screen
if self = 1, line color with be
- 6 -
Chapter 1: dObject Class Library
XOR'd with screen
sleep self sleeps for number of milliseconds
in self
sound self, Int generates sound of self ms duration
with frequency = Int arg
space self returns blank String of length=self
textMode self, Int sets text mode where number of rows
= self and number of columns =
Int arg, depending on hardware
normally set to 25,80 Example: on a
VGA, you can use textMode(50,80);
getPixel self, Int returns the pixel color at location
x,y specified by self and Int arg
putPixel self, Int, Int sets the pixel at location x,y
(self, Int arg) to color
specified by second Int arg
getImage self, Int returns image stored at x,y of
self, Int arg
imageSize self, Int, Int, Int returns an Int number of bytes
necessary to store a rectangular
area of the screen. Args are
left, top, right, and bottom
co-ordinates of the region.
putImage self, Int, Image, writes an image to the screen at
Int x,y of self, first Int arg.
Second Int arg specifies how bits
of the image will be combined with
bits already on the screen: copy
= 0, xor = 1, or = 2, and = 3, not
= 4.
setViewPort self, Int, Int, Int,sets the current viewport to the
Int absolute screen co-ordinates left,
top, right, bottom corresponding
to the self argument and the first
three Int arguments respectively.
The final Int arg is a flag
indicating if clipping is on or off
(0 = off,1 = on).
setActivePage self sets the active graphics page to
page number of self.
setVisualPage self sets the visible graphics page to
page number of self.
setTextJustify self, Int sets justification to horizontal
code of self and vertical code of
Int arg. Horizontal values:
0=left,1=center,2=right Vertical
values: 0=bottom,1=top
setTextStyle self, Int, Int sets current text font to self;
sets current direction to first
Int arg, and current char size
to second Int arg. Text direction
codes are 0=horizontal (left to
- 7 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
right), 1=vertical (bottom to top).
setUserCharSizeself, Int, Int, Int sets width and height ratio for
stroked fonts. Sets scale factors
for x width, x height, y width,
and y height to self and the 3 Int
args respectively.
setFillStyle self, Int sets the current fill pattern to
the predefined pattern with a
code of self and the current fill
color to the Int arg. Pattern
codes are: 0 (EMPTY_FILL) - fill
with background color 1
(SOLID_FILL) - solid fill 2
(LINE_FILL) - fill with ---- 3
(LTSLASH_FILL) - fill with /// 4
(SLASH_FILL) - fill with ///, thick
lines 5 (BKSLASH_FILL) - fill
with backslash, thick lines 6
(LTBACKSLASH_FILL) - fill with
backslash 7 (HATCH_FILL) - light
hatch fill 8 (XHATCH_FILL) -
heavy cross hatch fill 9
(INTERLEAVE_FILL) - interleaving
line fill 10 (WIDE_DOT_FILL) -
widely spaced dot fill 11
(CLOSE_DOT_FILL) - closely spaced
dot fill 12 (USER_FILL) -
user-defined fill pattern (see
Collection::setFillPattern())
floodFill self, Int, Int fills an enclosed area on the
graphics screen. Self and the
first Int arg form a "seek point":
within the enclosed area to be
filled. The are bounded by the
color indicated in the second Int
arg is flooded with the current
fill pattern and fill color. If
the seed point is within an
enclosed area, the the inside will
be filled. If the seed is
outside the enclosed the area, then
the exterior will be filled.
setBkColor self sets the current background color
to self
setColor self sets the current drawing color to
self
setPalette self, Int changes the color value stored
under self to the color in the
Int arg
rectangle self, Int, Int, Int draws a rectangle in the current
line style, thickness, and drawing
color. Arguments are left, top,
- 8 -
Chapter 1: dObject Class Library
right, and bottom co-ordinates of
the rectangle to draw (from
(left,top) to (right,bottom)).
bar self, Int, Int, Int draws a rectangular bar in the
current line style, thickness,
and drawing color, and fills it
using the current fill pattern and
fill color. Arguments are left,
top, right, and bottom co-ordinates
of the rectangle to draw (from
(left,top) to (right,bottom)).
bar3d self, Int, Int, Int,draws a rectangular 3-D bar in
Int, Int the current line style, thickness,
and drawing color, and fills it
using the current fill pattern and
fill color. Arguments are left,
top, right, and bottom co-ordinates
of the rectangle to draw (from
(left,top) to (right,bottom)),
the depth of the bar, and a flag
indicating if a top to the bar
should be drawn (0=no, 1=yes).
ellipse self, Int, Int, Int,draws an ellipse in the current
Int, Int) drawing color. Args are center
point X,Y, start angle, end
angle, and X and Y radius.
fillEllipse self, Int, Int, Int)draws an ellipse and fills it with
the current fill pattern in the
current fill color. Args are X,
Y, X radius, and Y radius.
pieSlice self, Int, Int, Int,draws and fills a pie slice using
Int current fill pattern and drawing
color. Arguments are X,Y
center, start angle, end angle, and
radius.
pieSliceXY self, Int, Int, Int,draws and fills an elliptical pie
Int, Int slice using current fill pattern
and drawing color. Arguments
are X,Y center, start angle, end
angle, X radius, and Y radius.
setAspectRatio self, Int sets the x and y aspect-ratio
correction factors to self and
Int arg respectively.
arc self, Int, Int, Int,draws a circular arc in the current
Int drawing color. Arguments are
X,Y center, start angle, end
angle, and radius.
circle self, Int, Int draws a circle in the current
drawing color. Arguments are X,Y
of center, and radius.
setLineStyle self, Int, Int sets the current line style to the
code in self; sets the current
- 9 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
pattern to the first Int arg
code, and the current thickness to
the second Int arg. Line style
codes are 0=solid,1=dotted,
2=center, 3=dashes,
4=user-defined. You can define a
line style by using a 16-bit
pattern in the first Int arg, where
whenver a bit in the pattern is
set to one, the corresponding pixel
in the line is drawn in the
current drawing color. For
example, a solid line is
represented by the value $FFFF
(all one's), and a dashed line is
$3333 or $0F0F. Thickness codes
in the second Int arg are 0=1 pixel
wide, 3=3 pixels wide.
line self, Int, Int, Int draws a line in the current drawing
color. Arguments are X,Y of start
point and X,Y of end point.
linerel self, Int draws a line in the current drawing
color from current position to
relative offset of self, Int arg.
lineto self, Int draws a line in the current drawing
color from current position to
X,Y position of self, Int arg.
moveTo self, Int moves the CP to X,Y of self, Int
arg
moveRel self, Int moves the CP the X,Y relative
distance
getModeName self returns a String containing the
graphics mode name for the mode
with Int code of self.
getModeRange self returns a Collection of 2 Int
values specifying the min and max
mode values for the graphics driver
with Int code of self.
setGraphMode self changes the graphics mode to self.
outTextXY self, Int, String outputs String arg to x,y location
of self, Int arg in current font,
style, and size
1.4 Long Class
Message Argument(s) Description
asAddress self returns self converted to Address
asInt self returns self converted to Int
asReal self returns self converted to Real
class self returns the String "Long"
operator(+) self, Long returns self plus argument as Long
- 10 -
Chapter 1: dObject Class Library
operator(-) self, Long returns self minus argument as Long
operator(-) self returns negative of self as Long
operator(*) self, Long returns self multiplied by argument
as Long
operator(/) self, Long returns self divided by argument as
Long
1.5 Real Class
Message Argument(s) Description
abs self returns absolute value of self as
Real
asInt self returns self converted to Int
asDate self returns Date having julian number
of self
asLong self returns self converted to Long
asString self returns self as a String
class self returns the String "Real"
cos self returns cosine of self as Real;
self in radians
format self, String formats self into String using
format contained in String arg
Format codes: %g Reals in shortest
posible format (default for reals)
%e Reals in exponetial notation
%f Reals in fixed notation
max self, Real returns max of self and argument as
Real
min self, Real returns min of self and argument as
Real
operator(+) self, Real returns self plus argument as Real
operator(+) self, Int returns self plus argument as Real
operator(-) self, Real returns self minus argument as Real
operator(-) self, Int returns self minus argument as Real
operator(-) self returns negative of self as Real
operator(*) self, Real returns self multiplied by argument
as Real
operator(*) self, Int returns self multiplied by argument
as Real
operator(/) self, Real returns self divided by argument as
Real
operator(/) self, Int returns self divided by argument as
Real
operator(<) self, Real returns true if self less than
argument
operator(>) self, Real returns true if self greater than
argument
operator(<=) self, Real returns true if self less than or
equal to argument
operator(>=) self, Real returns true if self greater than
or equal to argument
- 11 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
operator( returns self raised to power in self, Real
Real arg
operator(==) self, Real returns true if self is equal to
argument
operator(!=) self, Real returns true if self is not equal
to argument
sin self returns sine of self as Real; self
in radians
sqrt self returns square root of self as Real
tan self returns tangent of self as Real;
self in radians
trunc self returns self truncated after
decimal point
1.6 String Class
Message Argument(s) Description
operator(==) self, String returns true if self is equal to
argument
operator(!=) self, String returns true if self is not equal
to argument
operator(<) self, String returns true if self less than
argument
operator(>) self, String returns true if self greater than
argument
operator(<=) self, String returns true if self less than or
equal to argument
operator(>=) self, String returns true if self greater than
or equal to argument
operator(+) self, String returns self concatenated with
argument
operator($) self, String returns true if argument is
substring of self
accept self prints self as prompt to current
window returns String read as
input from keyboard
asDate self, String returns Date resulting from
conversion of self under format
specified by String arg
asExp self returns Exp parsed from text in
self
asId self returns self as an Exp of type ID
(like #a);
asInt self returns self as an Int
asLogical self returns self as Logical (self must
be "T" or "F")
asLong self returns self as Long
asLower self returns self with all lowercase
char
asUpper self returns self with all uppercase
char
- 12 -
Chapter 1: dObject Class Library
at self, Int returns character at position
indicated by argument
createDbf self, Collection returns Dbffile of new DBASE file
created with name of self and
fields defined in Collection arg
class self returns the String "String"
cursorstate self sets cursor to on/off state
specified in self ("on" or "off")
deleteFile self deletes the DOS file with name
specified by self
dir self, String returns filename selected from
directory menu as String with
directory path in "self" and file
pattern in argument
disk self sets the current disk and directory
to path in self
display self displays self in current window
do self executes statements in file with
filename of self
envSymbol self returns value of DOS symbol
specified by self
edit self calls editor on self in current
window
editFile self calls editor on contents of file
with filename of self
errorMessage self, Int returns String error message from
error file in filename specified
in self Int arg = error number to
find message for
existFile self returns logical T if file with name
of self exists else returns
logical F
fileString self returns contents of file with
filename of self as String
format self, String returns String arg formatted using
format spec in self Format codes:
%s Strings.
help self displays hypertext help for
topic=self
installUserDriverself installs third-party BGI driver
with filename of self returns Int
driver number of installed driver
installUserFontself installs thirt-party BGI font with
filename of self returns Int font
number of installed font
len self returns length of self as Int
loadConfig self load keyboard config from .CFG file
with filename of self
match self, String returns String that matches self
against GREP pattern in String
arg. Special characters: '
start-of-line anchor '$'
- 13 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
end-of-line anchor '.' matches
any character '[' start a
character class ']' end a
character class ' negates
character class if 1st char '*'
Keene closure (matches 0 or more)
'+' positive closure (1 or more)
'?' optional closure (0 or more)
mkdir self creates DOS directory with path
specified in self
replace self, Char, Char replaces every instance of first
char within self with second
char. Replaces string in-place
(does not simply return a copy
of self)
reverse self returns self with characters in
reverse order
saveConfig self save current keyboard config in
.CFG file with filename of self
set self returns the value of the SET
variable named by self
set self, Value sets the SET variable named by self
to Value Example: set("echo", T);
split self returns Collection of 3 Strings
containing split of self into
path, filename, and file extension
system self, Int executes DOS command in self Int
arg=0 do not reset video Int
arg=1 reset video to state it was
in before DOS cmd returns the Int
DOS error code returned by the
command
token self returns a Collection of 2 Strings
first String is the next token
within self second String is
resulting string (self without
first token) Example: token("1 2
3"); returns ["1","2 3 "]
trim self returns self with trailing blanks
trimmed
wrap self, Int, Char returns self word wrapped Int arg
= max column width to word wrap for
Char arg = char to embed at word
wrap points
outText self outputs a string to the current
graphics position (CP).
textHeight self returns height of self in pixels as
Int
textWidth self returns width of self in pixels as
Int
- 14 -
Chapter 1: dObject Class Library
1.7 Char Class
Message Argument(s) Description
asc self returns Int numeric value of self
asLower self returns self converted to lower
case
asUpper self returns self converted to upper
case
class self returns the string "Char"
diskspace self returns Real number of bytes on
disk with drive letter of self
unread self pushes self back into keyboard
buffer
1.8 Logical Class
Message Argument(s) Description
class self returns the string "Logical"
operator(&) self, Logical returns true if self and arg are
true
operator(|) self, Logical returns true if self or arg is true
operator(!) self returns logical NOT of self
1.9 Date Class
Message Argument(s) Description
asString self, String returns String of self formatted as
specified in String arg Codes: CC
2-digit century, YY 2-digit year,
MM 2-digit month MMM 3-char
month, DD 2-digit day Examples:
YY.MM.DD, CCYY.MM.DD, MM/DD/YY,
DD-MM/YY, DD-MM/CCYY, MMM DD/YY
asJulian self returns julian number of self as
Real
class self returns the String "Date"
cmonth self returns name of month of self as
String
day self returns day of self as Int
dow self returns number of day of week of
self as Int
month self returns month of self as Int
operator(+) self, Int returns date of self plus number of
days in argument
operator(-) self, Int returns date of self minus number
of days in argument
operator(==) self, Date returns true if self is equal to
argument
operator(!=) self, Date returns true if self is not equal
- 15 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
to argument
operator(<) self, Date returns true if self less than
argument
operator(>) self, Date returns true if self greater than
argument
operator(<=) self, Date returns true if self less than or
equal to argument
operator(>=) self, Date returns true if self greater or
equal to argument
setDay self, Int returns self with day = argument
setMonth self, Int returns self with month = argument
setYear self, Int returns self with year = argument
year self returns year of self as Int
1.10 Collection Class
Message Argument(s) Description
append self, Object appends Object arg to end of self
at self, Int returns object at position
specified by Int arg
avg self returns average of all elements in
self
class self returns the string "Collection"
head self returns first element of self
insert self, Object inserts Object arg at front of self
intersect self, Collection returns intersection of self and
Collection arg
len self returns the number of elements in
self as Int
max self returns maximum element in self
min self returns minimum element in self
operator(+) self, Object returns self with Object arg
appended
operator($) self, Object returns Logical .T. if Object arg
is in self
remove self, Object returns self with every occurrence
of Object arg deleted
replace self, Object, Objectreturns self with every occurrence
of first Object arg replaced by
second Object arg
reverse self returns self in reverse order
sort self returns self with elements in
ascending order
subset self, Collection returns Logical .T. if Collection
arg is a subset of self; else
returns logical .F.
sum self returns all elements in self added
tail self returns self without first element
union self, Collection returns union of self and
Collection arg
unique self returns Collection with distinct
- 16 -
Chapter 1: dObject Class Library
elements in self only
drawPoly self draws a polygon with as many points
as Int value pairs in the
collection; each Int pair is an
x,y co-ordinate of a vertex on the
polygon.
fillPoly self draws a polygon with as many points
as Int value pairs in the
collection and fills it using
the current fill style and fill
color; each Int pair is an x,y
co-ordinate of a vertex on the
polygon.
setAllPalette self sets list of new palette colors.
self must be a Collection of 8
Int values specifying the colors.
setFillPattern self, Int sets the current fill pattern to a
user-defined Collection of 8 Int
color values. Each Int value
represents a byte of 8 pixels;
whenever a bit in the pixel
pattern is set to 1, the
corresponding pixel will be
plotted. The Int arg is the fill
color to use.
1.11 Menu Class
Message Argument(s) Description
choice self, Int returns index of choice picked when
menu is executed menu bar is
positioned at choice number
indicated by Int arg menu is left
displayed in current window (see
Menu::remove())
class self returns the String "Menu"
remove self removes self from screen
window self returns the Window associated with
self
1.12 Linemenu Class
Message Argument(s) Description
choice self returns index of choice picked when
menu is executed menu is left
displayed in current window (see
Linemenu::remove())
class self returns the String "Linemenu"
remove self removes self from screen
- 17 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
1.13 Window Class
Message Argument(s) Description
class self returns the string "Window"
clear self clears text in self
clearGets self removes all SAY and GET fields
within self
clearKeys self removes all onKey definitions for
self
contents self returns String containing current
Window contents
currentField self returns Field object that is
current for full screen input
mode
draw self draws all SAY and GET fields within
self but does not read them
firstField self returns first GET Field defined for
self. See Window::read,
Window::nextField,
Window::prevField.
gotoField self, Field positions cursor at beginning of
field and enters full screen
input mode. See Window::read.
nextField self returns Field immediately after
current input Field. see
Window::read, Window::firstField,
Window::prevField.
onKey self, Int, Exp called from Window::read() method
whenever a key is pressed from
within the form; default is to call
Int::executeKey() but can be
re-defined to allow application
to trap certain keys Int arg =
key to trap Exp arg = expression
to evaluate when key equal to Int
arg is pressed
prevField self returns Field immediately prior to
current input Field. see
Window::read, Window::firstField,
Window::nextField.
read self draws all SAY and GET fields.
Positions cursor at first GET field
and enters full screen input
mode. The following keys are
active: Esc - exits the form and
returns to dObject> prompt Home -
Positions the current DBF file at
the first record and displays it
End - Positions the current DBF
file at the last record and
displays it PgUp - Positions the
- 18 -
Chapter 1: dObject Class Library
current DBF file at the previous
record and displays it PgDn -
Positions the current DBF file at
the next record and displays it
Tab - Positions the cursor at the
beginning of the next display field
Up - Positions the cursor up one
line Down - Positions the cursor
down one line Right - Positions
the cursor right one space within
current display field Left -
Positions the cursor left one space
within the current display field
F10 - exits the form and returns to
dObject> prompt
remove self removes self from the screen
resize self allows user to interactively resize
self using arrow keys
resize self, Int, Int, Int,change size of self to y, x, ylen,
Int xlen Int args
say self, Int, Int, displays Value argument within self
Value, Int, Int Int arg #1 = y coordinate of
field Int arg #2 = x coordinate
of field Value arg = value to
disp Int arg#3 = length of field
Int arg#4 = color attribute of
field
sayExp self, Int, Int, Exp,displays Exp argument within self
Int, Int but waits until "read" is issued
before evaluating Exp Int arg #1
= y coordinate of field Int arg
#2 = x coordinate of field Value
arg = value to disp Int arg#3 =
length of field Int arg#4 = color
attribute of field
scroll self, Int, Int scrolls self in Y,X direction of
Int args
select self makes self the current Window. see
Nil::currentWindow.
setupColor self, Int interactively change window color
based on menu choice Int arg=0
setup window color Int arg=1
setup frame color
setFrame self, Int, String, sets frame characteristics Int
Int, String arg #1 = frame color (attribute)
String arg #1 = window title Int
arg #1 = position of start of title
(255 = center) String arg #2 =
characters in frame string
setTitle self, String returns self with title = argument
setPosition self, Int, Int, Int,returns self with position = Int
Int arguments (x, y, length, height)
- 19 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
title self returns String containing title of
self
1.14 Dbffile Class
Message Argument(s) Description
asCollection self returns array of values of argument
expression evaluated for each
record in self that is true for the
current filter expression
avg self, Exp returns average value of Exp
evaluated across all records
blank self fills the current record buffer for
self with blanks
class self returns the String "Dbffile"
close self closes the .DBF file for self;
returns nil
bot self positions current record at bottom
of file using current index file.
If no index is open, go to
physical last record in self
Returns 0 if OK, 3 if EOF, -1 if
Error
clearIndexes self closes all open index files
associated with self returns Int
0 if OK, -1 if error
clearRelation self Removes all relationships for self
(see Dbffile::setRelation())
returns Int 0 if OK, -1 if error
createIndex self, String, creates a new DBASE index file on
String, Int, Int self String arg1 = name of index
to create String arg2 = text for
expression to evaluate for index
Int arg1 = unique flag 1=unique
0=not unique Int arg2 = safety
flag 1=do not remove existing
file with this name 0=remove any
existing file with this name
returns Int reference number of
index created if OK, -1 if error
date self returns creation date of self
decimals self, String returns Int number of decimals in
field named in String arg
delete self, Long deletes record number = Long arg
within self
eof self returns Logical .T. if current
record is at end of file; else
returns Logical .F.
fieldString self returns the internal buffer for
field name = String arg as String
at current record of self; can be
- 20 -
Chapter 1: dObject Class Library
used to determine if named field
is blank or empty
go self, Long returns self with current record at
record number specified by arg
htExpand self, Ndxfile, Int, expands text into hypertext self
Int, String arg = DBASE file containing topic
and text fields to use as hypertext
dictionary Ndxfile arg = DBASE
index on topic field Int arg#1 =
color to highlight topics with in
expanded text Int arg#2 = length
of topic field String arg#1 =
normal text to be expanded into
hypertext Returns String
containing hypertext
insert self, Long The record in the record buffer
becomes the record number
indicated by the Long arg. All of
the former records starting at
this position are copied forward
one record to insert the new
record. All of the open index
files for self are then reindexed
to maintain their correct record
numbers. Returns 0 if OK, -1
if error.
locate self, String, Value locates record with field of name
in String arg and value of Value
arg through sequential search
starting at current record
lock self, Int, Int attempts to lock self; returns 0 if
successful if argument#1 is 0,
locks record if argument#1 is 1,
locks entire file if argument#2
is 0, waits until lock succeeds
if argument#s is 1, does not wait
max self, Exp returns maximum value of Exp
evaluated for all records in file
min self, Exp returns minimum value of Exp
evaluated for all records in file
name self returns filename of self
numFields self returns Int number of fields in
self
numRecords self returns Long number of records in
self
pack self, Long, Long deletes records in self from
recno=first arg to recno=second arg
recall self, Long recalls record number = Long arg
from being deleted
recno self returns Long current record number
of self
seek self, Object goes to record number in self that
- 21 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
matches Object arg by doing a
binary search of currently selected
.NDX file returns Int values: 0
exact match with key was found 1
partial match 2 key not found;
position is on record after where
key should be in Dbffile 3 end of
file -1 error
select self selects self as current database
returns Int ref number of self
setFilter self, Exp returns self with filter set to
argument Future operations on
self will only process records that
cause Exp to evaluate to Logical
.T. Example: d =
new(Dbffile,"test");
setFilter(d,#recno(d) > 5);
setRelation self, String, Int, Creates a relationship between a
Int, Int controlling database and self.
When self is repositioned, the
expression in the String arg is
looked up in the index file to
move to a record in the related
database. If no index file is
specified the expression should
return a Long value that is used
as the record number to go to in
the related database. String
arg = text for expression to
evaluate as described above Int
arg1 = database reference number
for related database Int arg2 =
index reference number of index to
use (-1 if no index) Int arg3 =
Missing code; specifies action to
take if record not found in related
database =0 use blank record
=1 generate error message >=1
default record number Returns Int
0 if OK, -1 if error
skip self, Long increments current record position
by argument
structure self returns Collection of field
definitions for self (see
Dbffile::create())
sum self, Exp returns sum of Exp evaluated for
all records in file
top self positions current record in self at
top of file using current index
If no index is open, go to
physical first record in self
returns 0 if OK, -1 if error
- 22 -
Chapter 1: dObject Class Library
unlock self, Int attempts to unlock self If Int
argument is 0 unlocks record; else
unlocks file returns Int 0 if OK,
-1 if error
width self, String returns width of field specified by
argument as Int
write self, Long write the contents of the current
record to file at record number
indicated by Long arg. If Long
arg = 0, append new record at end
of file. Returns 0 if OK, -1 if
error
zap self, Long, Long delete records in file from record
number specified in first Long arg
up to record number specified by
second Long arg Returns 0 if OK,
-1 if error
1.15 Ndxfile Class
Message Argument(s) Description
bot self positions current record of self at
bottom
class self returns the String "Ndxfile"
close self closes the .NDX file for self
lock self, Int locks self Int arg = wait flag
=0 do not wait if file is locked by
another user =1 keep trying (once
per second) if file is locked
returns 0 if OK, -1 if error, -2
if file is locked by another
user and wait=0 was specified
reindex self reindexes self returns 0 if OK,
-1 if error
select self selects self as current index file
returns Int ref number of self
skip self, Long skips the number of records in self
indicate by Long arg returns 0 if
OK, -1 if error
top self positions current record of self at
top of file returns 0 if OK, -1
if error
type self returns Char type of self using
DBASE conventions for type C=char
, D=date, N=numeric, M=memo
unlock self unlocks self; returns Int 0 if OK,
-1 if error
- 23 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
1.16 File Class
Message Argument(s) Description
class self returns the String "File"
close self closes self; returns nil
flush self flushes self; returns nil
readDevice self sets current input device to self
seek self, Int, Int sets byte position within self
using offset in first Int arg
second Int arg = offset position
flag =0 offset from beginning of
file =1 offset from current
position =2 offset from end of
file
writeDevice self sets current output device to self
1.17 Exp Class
Message Argument(s) Description
class self returns the String "Exp"
eval self evaluates self and returns value
inherit self, Exp, creates new class with parent class
Collection specified in self Exp arg = ID
name of new class Collection arg
= collection of String(s)
specifying names of class
variables in the new class Example:
inherit(Int, Newint, ["i"]);
friend self, Exp defines class in Exp arg as a
friend of class in self (both
arguments must be of type ID)
allows class in Exp arg access to
variables and private methods
for class in self
name self returns String that is name of Exp
if Exp is of type ID
new self... returns a new object of type
specified by self (self=ID).
Arguments depend on class type.
Example: i = new(Int, 1); r =
new(Real, 1.1); l = new(Logical,
T); w = new(Window, 1, 31, 3, "
title ", 0, 0, 24, 80); db =
new(Dbffile, "help"); ndx =
new(Ndxfile, db, "help"); arr =
new(Array,[3,3,3]); coll =
new(Collection); file =
new(File,"prn:",1,0,0); m =
new(Linemenu,1,5,54,54,[1,2,3,4,5,6],
- 24 -
Chapter 1: dObject Class Library
["first","second","third","fourth","fifth","sixth"]);
release self release variable named by self.
Example: release(#a);
releaseClass self releases all class definitions,
all variables, and all method
definitions for class named by
self. Example:
releaseClass(Newint);
1.18 Address Class
Message Argument(s) Description
asLong self returns self as Long value
operator(*) self returns contents at address of self
as Object
1.19 Object Class
Message Argument(s) Description
parent self returns parent object of self if
self is NOT a base class
slot self, String returns value of class variable
within self with name = String
argument. This method only works
from within methods defined for
self's class !
operator(&) self returns address of self as Address
object
replace self, Object replaces value of self with Object
arg
1.20 Field Class
Message Argument(s) Description
attr self returns the color attribute of self
class self returns the String "Field"
col self returns the column position of self
name self returns the name of self
num self returns the field number of self
onKey self, Int, Exp called from Window::read() method
whenever a key is pressed from
within the form; default is to call
Int::executeKey() but can be
re-defined to allow application
to trap certain keys Int arg =
key to trap Exp arg = expression
to evaluate when key equal to Int
arg is pressed
- 25 -
dObject Version 1.0 (c) 1991 Intelligent Systems Research
row self returns the row position of self
setPicture self, String sets the picture for self to String
arg. Special characters in
format: ! Converts letters to
uppercase; accepts all characters
A Allows letters only L
Translates characters to logical
values (T, t, F, f, Y, y, N, n) N
Allows letters and numbers 9
Allows digits only X Allows
numbers, spaces, signs, and decimal
points only
- 26 -